package com.mapper;

import com.entity.ProdType;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.vo.OrdersVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author aiou
 * @since 2025-06-12
 */
@Mapper
public interface ProdTypeMapper{

    //品种类别：分页查询
    @Select("select * from prod_type")
    List<ProdType> list();

    //品种类别：新增/修改-根据编码查询
    @Select("select * from prod_type where prod_type_code = #{prodTypeCode}")
    ProdType getOne(String prodTypeCode);

    //品种类别：新增
    @Insert("insert into prod_type(prod_type_code,prod_type_name) values(#{prodTypeCode},#{prodTypeName})")
    boolean save(ProdType prodType);
    //品种类别：修改
    @Insert("update prod_type set prod_type_code = #{prodTypeCode},prod_type_name = #{prodTypeName} " +
            "where prod_type_id = #{prodTypeId}")
    boolean update(ProdType prodType);

    //品种类别：删除
    @Delete("delete from prod_type where prod_type_id = #{id}")
    boolean delete(Integer id);
}
